<template>
  <div class="achievement" v-cloak>
    <div class="bg_color"></div>
    <div style="height: 4px;position: absolute;z-index: 2222; width: 100%; top: 46px;background: #f0f0f0"></div>
    <div style="height: 50px;"></div>
    <div class="about-us" v-show="show">
      <div class="content">
        <input class="editInput" type="number" placeholder="请输入支付宝账户" v-model='ali_account'>
        <div class="saveBtn" @click="submit">绑定</div>
      </div>
    </div>
  </div>
</template>
<script>
  export default {
    name: 'BindZfb',
    data () {
      return {
        show: true,
        ali_account: ''
      }
    },
    methods: {
      submit: function () {
        if (!this.ali_account) {
          thisObj.$vux.toast.show({
            text: '请输入支付宝账户',
            type: 'text',
            width: '180px',
            position: 'bottom'
          })
          return false
        }
        let thisObj = this
        thisObj.$chaos.ajax({
          data: {
            ali_account: thisObj.ali_account
          },
          slient: true,
          userinfo: true,
          url: 'User/bindingAliAccount',
          callback: function (type, res) {
            if (res.status === 'SUCCESS') {
              thisObj.$vux.toast.show({
                text: res.result.msg,
                type: 'text',
                width: '180px',
                position: 'bottom'
              })
              setTimeout(function () {
                window.history.back(-1)
              }, 400)
            } else {
              thisObj.$vux.toast.show({
                text: res.result.msg,
                type: 'text',
                width: '180px',
                position: 'bottom'
              })
            }
          }
        })
      },
      verify: function () {
        this.$chaos.setTitle('绑定支付宝账号')
        this.$store.commit('headerShow', true)
        this.$store.commit('title', '绑定支付宝账号')
        this.$store.commit('footerShow', false)
      }
    },
    created: function () {
      this.verify()
    },
    mounted: function () {
      window.scrollTo(0, 2000)
    },
    watch: {
      '$route': 'verify'
    }
  }
</script>
<style scoped>
  [v-cloak] {
    display: block;
  }
  body,
  html {
    background: #f9f9f9;
  }
  .editInput {
    width: calc(100% - 30px);
    padding: 0 15px;
    height: 40px;
    line-height: 40px;
    background: #fff;
    border-bottom: 1px solid #eee;
  }
  input, button, textarea {
    border: 0;
    margin: 0;
    padding: 0;
    outline: none;
    resize: none;
  }
  .saveBtn {
    width: calc(100% - 30px);
    margin: 0 auto;
    background-color: #ffa128;
    height: 40px;
    line-height: 40px;
    text-align: center;
    border-radius: 6px;
    color: #fff;
    margin-top: 15px;
    font-size: 16px;
  }
</style>
